#include <stdio.h>
#include <stdlib.h>

struct node {
	int data;
	struct node *next;
};

void push(struct node **, int);

void main(void) {
	struct node *head = NULL;
	int i;

	push(&head, 0);

	struct node *tail;
	tail = head;

	for (i = 1; i < 10; i ++) {
		push(&(tail->next), i);
		tail = tail->next;
	}

	struct node *test = head;

	for (i = 0; i < 10; i ++) {
		printf("%d ", test->data);
		test = test->next;
	}
	printf("\n");
}

void push(struct node **ref, int data) {
	struct node *new_node = malloc(sizeof(struct node));

	new_node->data = data;
	*ref = new_node;
}
